#region license
# This file is part of Grawlix.
# 
# Grawlix is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of
# the License, or (at your option) any later version.
# 
# Grawlix is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public
# License along with Grawlix.  If not, see
# <http://www.gnu.org/licenses/>.
#endregion

"""The mutable builder interface into sprite data."""

namespace Grawlix.Services.Rendering
import System
import System.Xml.XPath

class SpriteBuilder:
"""The builder interface describing sprite data."""
	
	def constructor():
	"""
	Defaultly initializes a sprite builder object.
	"""
		pass
	
	def constructor([required] sprite as ISpriteResource):
	"""
	Initialize a sprite builder object from a given sprite.
	Param sprite: The sprite to initialize from, expected to be Ready.
	Raises ArgumentException: sprite.Ready is false.
	"""
		if not sprite.Ready:
			raise ArgumentException(
				"The given sprite (${sprite}) is " +
				"not loaded.",
				"sprite")
		
	
	static def FromXml([required] node as IXPathNavigable):
	"""
	Creates a new sprite from XML data.
	Param node: The root XML node of the sprite data.
		Note that this should not be an XMLDocument node.
	Returns: The brand-new set of sprite state.
	Remarks: Rather than creating state directly,
		use the DefaultSpriteFactory.
	"""
		builder = SpriteBuilder()
		return builder
	
	Animations as ISpriteAnimation*:
		get:
			return null
	
	[getter(FriendlyName)]
	private _friendlyName as string
	"""The friendly name of the sprite."""
	
	